package model;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.LocalDateTime;

/**
 * 预约实体类
 */
public class Reservation {
    private int reservationId;
    private int userId;
    private int seatId;
    private LocalDate reservationDate;
    private LocalTime startTime;
    private LocalTime endTime;
    private int status; // 0: 有效, 1: 已取消, 2: 已完成
    private LocalDateTime createTime;

    // 关联对象
    private User user;
    private Seat seat;

    public Reservation() {
    }

    public Reservation(int userId, int seatId, LocalDate reservationDate,
            LocalTime startTime, LocalTime endTime) {
        this.userId = userId;
        this.seatId = seatId;
        this.reservationDate = reservationDate;
        this.startTime = startTime;
        this.endTime = endTime;
        this.status = 0;
        this.createTime = LocalDateTime.now();
    }

    // Getters and Setters
    public int getReservationId() {
        return reservationId;
    }

    public void setReservationId(int reservationId) {
        this.reservationId = reservationId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getSeatId() {
        return seatId;
    }

    public void setSeatId(int seatId) {
        this.seatId = seatId;
    }

    public LocalDate getReservationDate() {
        return reservationDate;
    }

    public void setReservationDate(LocalDate reservationDate) {
        this.reservationDate = reservationDate;
    }

    public LocalTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalTime startTime) {
        this.startTime = startTime;
    }

    public LocalTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalTime endTime) {
        this.endTime = endTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Seat getSeat() {
        return seat;
    }

    public void setSeat(Seat seat) {
        this.seat = seat;
    }

    public String getStatusText() {
        switch (status) {
            case 0:
                return "有效";
            case 1:
                return "已取消";
            case 2:
                return "已完成";
            default:
                return "未知";
        }
    }
}
